package com.itheima.homework.two;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public enum Type {
    CHARGE_TYPE_CHARGED(1,"d"),CHARGE_TYPE_FREE(2,"s"),
    CHARGE_TYPE_MEMBER_RIGHTS(3,"4");

     int num;
     String pay;

    Type(int num, String pay) {
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getPay() {
        return pay;
    }

    public void setPay(String pay) {
        this.pay = pay;
    }

    public static String spay(int num){
        List<Type> lis = new ArrayList<>();
        lis.add(CHARGE_TYPE_CHARGED);
        lis.add(CHARGE_TYPE_FREE);
        lis.add(CHARGE_TYPE_MEMBER_RIGHTS);


        for (Type li : lis) {
            if(li.getNum() == num ){
                return li.getPay();
            }
        }

        return "号码错误";

    }
}
